<template>
<!--pages/select_city/select_city.wxml-->
<SelectCitiesView @citySelect="onCitySelect" letter-class="cityListLetter" item-class="cityListItem"></SelectCitiesView>
</template>

<script>
// pages/select_city/select_city.js
var cities = require("../../common/city.js");
import SelectCitiesView from "../../components/selectCity/selectCity";

export default {
  data() {
    return {
      allCities: [],
      location: ""
    };
  },

  components: {
    SelectCitiesView
  },
  props: {},

  /**a
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
		this.allCities = cities
  },
	
  methods: {
    onCitySelect(e) {
      console.log('城市选择', e);
      var pages = getCurrentPages();
			console.log('城市', pages);
      if (pages.length >= 2) {
        var prePage = pages[pages.length - 2];
        prePage.$vm.location = `${e.detail.city}市`
      };
      uni.navigateBack();
    }
  }
};
</script>
<style>
/* pages/select_city/select_city.wxss */

page {
     width: 100%;
     height: 100%;
     background: white;
}

.cityListLetter {
     width: 100%;
     padding: 16rpx 24rpx 0rpx;
     font-size: 30rpx;
     font-weight: bold;
     color: #ff7676;
     /* background-color: skyblue; */
}

.cityListItem {
     width: 100%;
     box-sizing: border-box;
     padding: 20rpx 10rpx 10rpx;
     margin-left: 14rpx;
     font-size: 26rpx;
     background-color: white;
     border-bottom: #dedede 1rpx solid;
}

</style>